package com.beiding.config;


import net.sf.ehcache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.ehcache.EhCacheCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableCaching
public class CachingConfig {

    @Bean
    public CacheManager ehCacheManager() {
        net.sf.ehcache.CacheManager manager = net.sf.ehcache.CacheManager.newInstance();

        //订单缓存
        manager.addCache(new Cache("order", 1024 * 5, true, false, 24 * 3600, 60));
        return new EhCacheCacheManager(manager);
    }

}
